package principle.dependencyInversion;

/*
    案例：
        Person类接收Email、WeChat、等发送的消息
    不适用依赖倒转原则
 */
public class Demo01 {
    public static void main(String[] args) {
        Person person = new Person();
        person.getInfoEmail(new Email());
        person.getInfoWeChat(new WeChat());
    }
}
class Email{
    public void sendMessage(){
        System.out.println("Email发送的消息...");
    }
}
class WeChat{
    public void sendMessage(){
        System.out.println("WeChat发送的消息...");
    }
}
class Person{
    public void getInfoEmail(Email email){
        email.sendMessage();
    }
    public void getInfoWeChat(WeChat weChat){
        weChat.sendMessage();
    }
}
